<template>
  <div id="layout-check">
    <div class="main show-width">
      <div class="top-bar">
        <div class="user-bar">
          <div class="shopname">
            <img
              class="logo"
              src="@/assets/login/small-logo-2x.png"
              alt="logo"
            />
          </div>
          <div class="user-info">
            <img src="@/assets/login/notice.png" alt="" class="notice" />
            <span>{{ getUserInfo.phone || "" }}</span>
            <img
              src="@/assets/login/go-to-link.png"
              alt=""
              class="go-to-link"
              @click="logout"
            />
          </div>
        </div>
      </div>
      <div class="content">
        <router-view></router-view>
      </div>
    </div>
  </div>
</template>
<script>
import { revokeServerToken } from "@/api/login";
import { removeToken } from "@/utils/auth.js";
export default {
  name: "CheckIn",
  data() {
    return {};
  },
  created(){

  },
  methods: {
    // 退出的方法
    logout() {
      revokeServerToken().then(() => {
        sessionStorage.clear();
        removeToken();
        this.setUserInfo({});
        this.$router.push("/login");
      });
    },
  },
};
</script>
<style lang="less" scope>
#layout-check {
  width: 100%;
  height: 100%;
  display: flex;
  background: #f0f2f5;
  justify-content: flex-start;
  .top-bar {
    height: 40px;
    width: 100%;
    background: #fff;
    border: 1px solid #ebeef5;
    box-sizing: border-box;
    .nav-bar {
      height: 40px;
      width: 100%;
      border-top: 1px solid #ebeef5;
      box-sizing: border-box;
      overflow: auto;
      display: flex;
      align-items: flex-end;
    }
    .user-bar {
      width: 100%;
      height: 40px;
      box-sizing: border-box;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding-left: 10px;
      padding-right: 20px;
      .shopname {
        font-size: 14px;
        color: #303133;
      }
      .user-info {
        display: flex;
        justify-content: flex-start;
        .notice {
          width: 16px;
          height: 16px;
          margin-right: 15px;
          cursor: pointer;
        }
        span {
          font-size: 14px;
          color: #606266;
          position: relative;
          top: 2px;
        }
        .go-to-link {
          width: 16px;
          height: 16px;
          margin-left: 10px;
          cursor: pointer;
        }
      }
    }
  }
  .main {
    height: 100%;
    display: flex;
    flex-direction: column;
    img.logo {
      width: 90px;
      height: 23px;
      margin-right: 10px;
    }
    .content {
      height: calc(100vh - 60px);
      margin: 10px;
    }
    .main-body {
      height: calc(100% - 80px);
      width: 100%;
      box-sizing: border-box;
      padding: 10px;
      overflow: auto;
      .nr {
        width: 100%;
        height: 100%;
        overflow: auto;
        background: #fff;
        box-sizing: border-box;
      }
    }
  }
  .show-width {
    width: 100%;
  }
}
/* fade-transform */
.fade-transform-leave-active,
.fade-transform-enter-active {
  transition: all 0.5s;
}

.fade-transform-enter {
  opacity: 0;
  transform: translateX(-30px);
}

.fade-transform-leave-to {
  opacity: 0;
  transform: translateX(30px);
}
</style>
